perm filename SYSFIX.FAI[SS,SYS]2 blob
sn#649806 filedate 1982-03-25 generic text, type T, neo UTF8
;F A B C D E T TT TTT W X Y Z P CHKBEG DS LDISK DISKBF LPDL PDL ACWPRV DMPFIL REENTA SYSFIX REENT2 NOPAT OLOOP TOOBIG INOK ILOOP NOFIX NODIFF DIFF FIXNOW YORN YORN0 YORN2 YORN3 YORN4 OCTOUT OCTOU2 OCTOU4 OCTOU3 DECOUT SYMLUZ SETLUZ NOLOOK FERROR MAXERR
TITLE SYSFIX Program to compare system core against version on disk.
F←0
A←1
B←2
C←3
D←4
E←5
T←6
TT←7 ;Must be T+1
TTT←←10 ;Clobberred by OCTOUT
W←13
X←14
Y←15
Z←16
P←17
CHKBEG←←223 ;LOWCORE loc pointing at CHKBEG
DS←←1
LDISK←←=18*200
DISKBF: BLOCK LDISK ;Space for data from disk version of system.
LPDL←←30
PDL: BLOCK LPDL
ACWPRV←←40 ;LH priv bit
LOC 124
REENTA ;Set up REENTER address
RELOC
DMPFIL: SIXBIT/WAITS/ ;DMP file holding system on disk
SIXBIT/DMP/
0
SIXBIT/ SSYS/
REENTA: SETOM FIXIT ;Flag reenter cmd, allow correcting system core
MOVSI A,1
GETPRV A, ;Get passive privs
TLNE A,ACWPRV ;Can this guy fix things?
JRST REENT2 ;Yes
SYSFIX: JFCL ;Allow for RPG startup
SETZM FIXIT# ;Not reentered, no fixing system
REENT2: RESET
MOVE P,[IOWD LPDL,PDL]
SETZM NDIFFS# ;Number of differences found
SETZM NFIXES# ;Number of words fixed from file
OUTSTR [ASCIZ/Comparing protected part of system with WAITS.DMP[S,SYS].
Any differences will be typed out/]
SKIPE FIXIT
OUTSTR [ASCIZ/ and you will be able to selectively
correct core from WAITS.DMP[S,SYS], in the order presented here.
Type Y<cr> or <bucky>Y when prompted to correct the core location,
but do NOT type ahead/]
OUTSTR [ASCIZ/.
/]
INIT DS,217
'DSK '
0
HALT .
MOVE Z,[DMPFIL,,W]
BLT Z,Z ;
LOOKUP DS,W
JRST NOLOOK
MOVSI A,ACWPRV
SKIPE FIXIT
SETPRV A, ;Enable
MOVSI A,377777
SKIPE FIXIT
TLZ A,1 ;Request write permission
SETPR2 A, ;MAP SYSTEM INTO UPPER SEGMENT
JRST SETLUZ
MOVE A,400000+CHKBEG ;Get address of start of checksummed part of system
MOVEI B,[RADIX50 0,PATCH↔0]
.SYML B, ;Get address of PATCH
MOVE B,A ;Undefined -- pretend PATCH is checksummed
MOVEM A,CHKB# ;Remember for difference checker, which will
MOVEI T,200(B) ; ignore core between PATCH+200 and CHKBEG
MOVEM T,PATC#
CAMN A,B
JRST NOPAT ;No patch
OUTSTR [ASCIZ/(Also checking PATCH = /]
MOVEI T,(B)
PUSHJ P,OCTOUT
OUTSTR [ASCIZ/)
/]
NOPAT: MOVE A,B ;Start comparing at PATCH
MOVEI B,[RADIX50 0,CHKEND↔0]
.SYML B, ;Get address of end of same
JRST SYMLUZ
CAIL B,400000 ;Better not run out of room in SETPR2 upper segment
JRST TOOBIG ;System is too big
OUTSTR [ASCIZ/
/]
SUBI B,-1(A) ;Amount of system to be checksummed
OLOOP: MOVEI C,-74(A) ;Next disk word we want
LSH C,-7 ;Adjust to record number (minus 1)
USETI DS,1(C) ;Read file at right place
IN DS,[IOWD LDISK,DISKBF↔0] ;Read whole track
JRST INOK
OUTSTR [ASCIZ/Error reading disk file./]
EXIT 1,
JRST OLOOP ;Try again?
TOOBIG: OUTSTR [ASCIZ/CHKEND in system is 400000 or greater! Must adjust
SETPR2 bounds in SYSFIX and recompile it./]
EXIT
INOK: MOVEI C,-74(A) ;Next disk word we want
ANDI C,177 ;Offset within first record read
MOVNI D,(C) ;Negative of number of words skipped starting record
ADDI D,LDISK ;D is now words to check in this disk track
CAML D,B ;Want to check remainder of track?
MOVE D,B ;No, only check amount left in system
SUB B,D ;Amount remaining next time at OLOOP
MOVN D,D ;Negative amt this buffer
HRLZ D,D ;AOBJN ptr into disk buffer
HRR D,C ;Skip over some words maybe
ILOOP: MOVE E,400000(A) ;Get word from system
CAME E,DISKBF(D) ;Same as on disk?
PUSHJ P,DIFF ;No!
ADDI A,1 ;Next system address
AOBJN D,ILOOP ;Next buffer address
JUMPG B,OLOOP ;Jump if more system to examine
RELEAS DS,
INSKIP ;Clear ESC O
JFCL
SKIPN T,NDIFFS
JRST NODIFF ;No differences
OUTSTR [ASCIZ/
/]
PUSHJ P,DECOUT ;Print number of differences
OUTSTR [ASCIZ/ difference/]
MOVE T,NDIFFS
CAIE T,1
OUTCHR ["s"]
OUTSTR [ASCIZ/ found/]
SKIPN T,NFIXES ;Any fixed?
JRST NOFIX
OUTSTR [ASCIZ/, /]
PUSHJ P,DECOUT ;Print number of fixes
OUTSTR [ASCIZ/ fixed/]
NOFIX: OUTCHR ["."]
MOVSI A,1
GETPRV A, ;Get passive privs
TLNE A,ACWPRV ;Can this guy fix things?
OUTSTR [ASCIZ/
Type REENTER monitor command to be able to selectively fix clobberages./]
EXIT
NODIFF: OUTSTR [ASCIZ/No differences encountered./]
EXIT
DIFF: CAMGE A,CHKB ;Is this address between PATCH+200 and CHKBEG?
CAMGE A,PATC
AOSA NDIFFS ;No count a difference
POPJ P, ;Yes, ignore this word (of data)
MOVEI T,(A) ;System address
PUSHJ P,OCTOUT ;Print octal address
OUTSTR [ASCIZ/[ /]]
HLRZ T,E ;System value
PUSHJ P,OCTOUT ;Print LH value from sys
OUTSTR [ASCIZ/,,/]
HRRZ T,E ;RH
PUSHJ P,OCTOUT ;Print RH value from sys
OUTSTR [ASCIZ/ should be /]
HLRZ T,DISKBF(D) ;LH
PUSHJ P,OCTOUT ;Print LH value from disk
OUTSTR [ASCIZ/,,/]
HRRZ T,DISKBF(D) ;RH
PUSHJ P,OCTOUT ;Print RH value from disk
OUTSTR [ASCIZ/ -- XOR is /]
XOR E,DISKBF(D) ;See what changed
HLRZ T,E ;XOR LH
PUSHJ P,OCTOUT ;Print LH value from XOR
OUTSTR [ASCIZ/,,/]
HRRZ T,E ;RH
PUSHJ P,OCTOUT ;Print RH value from XOR
SKIPE FIXIT
PUSHJ P,FIXNOW ;Maybe fix core if user wants
SKIPN FIXIT
OUTSTR [ASCIZ/
/]
POPJ P,
FIXNOW: OUTSTR [ASCIZ/ Fix?/]
PUSHJ P,YORN ;Yes or No
POPJ P, ;No
MOVE E,DISKBF(D) ;Get word from disk buffer
EXCH E,400000(A) ;Correct system (save old system value in case...)
AOS NFIXES ;Count fixes
POPJ P,
;Get Yes or No answer. Skip if Yes.
YORN: CLRBFI
INCHWL T ;Read a char from TTY
MOVE TT,T
ANDI TT,137 ;Flush bucky bits, make upper case
CAIN TT,"Y"
AOS (P)
YORN0: CAIE T,175 ;Altmode
TRNE T,600 ;Or bucky bits?
JRST YORN2 ;Yes, echo CRLF
CAIN T,12 ;LF
JRST YORN3 ;Yes, echo CR
CAIN T,15 ;CR
JRST YORN4 ;Yes, read LF
INCHWL T ;Skip to end of answer line
JRST YORN0
YORN2: OUTSTR [ASCIZ/
/]
POPJ P,
YORN3: OUTCHR [15] ;Echo CR after LF!
POPJ P,
YORN4: INCHWL T ;Read LF after CR
TRNE T,600 ;Bucky bits on LF?
JRST YORN2 ;Yes, echo CR
POPJ P,
OCTOUT: MOVEI TTT,6 ;Number of digits to print
OCTOU2: IDIVI T,10
PUSH P,TT
SUBI TTT,1 ;Count a digit going out
JUMPE T,OCTOU3
PUSHJ P,OCTOU2
OCTOU4: POP P,T
ADDI T,"0"
OUTCHR T
POPJ P,
OCTOU3: JUMPLE TTT,OCTOU4
MOVEI T,"0"
OUTCHR T
SOJA TTT,OCTOU3 ;Nice slow loop
DECOUT: IDIVI T,=10
PUSH P,TT
JUMPE T,.+2
PUSHJ P,DECOUT
POP P,T
ADDI T,"0"
OUTCHR T
POPJ P,
SYMLUZ: OUTSTR [ASCIZ/.SYML of CHKEND failed./]
EXIT
SETLUZ: OUTSTR [ASCIZ/SETPR2 failed./]
EXIT
NOLOOK: OUTSTR [ASCIZ/
LOOKUP failed -- /]
HRRZ X,X ;GET ERROR CODE
CAILE X,MAXERR
MOVEI X,MAXERR
OUTSTR @FERROR(X)
OUTSTR [ASCIZ/.
/]
JRST 4,SYSFIX
FERROR: [ASCIZ/No such file/]
[ASCIZ/No such PPN/]
[ASCIZ/Protection violation/]
[ASCIZ/File busy/]
MAXERR←←.-FERROR
[ASCIZ/Bad retrieval or other horrible error/]
END SYSFIX